package com.wasion.gydpe.ice;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

/**@Service
@Lazy(false)**/
public class Ice_Start {

	private static final Logger LOGGER = LoggerFactory
			.getLogger(Ice_Start.class);

	private static InitServer instance = null;

	public synchronized static InitServer getInstance() {
		if (instance == null)
			instance = new InitServer();
		return instance;
	}

	public Ice_Start() {
		try {
			init();
		} catch (Exception e) {
			e.printStackTrace();
			LOGGER.error("Ice_Start发送异常：Ice_Start >>>>>> " + e);
		}
	}

	public void init() throws Exception {

		ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 4, 3,
				TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(3),
				new ThreadPoolExecutor.DiscardOldestPolicy());
		threadPool.execute(new Ice_Thread());
	}

}
